<template>
  <div>
    <el-form-item label="题目范围:" prop="range">
      <el-radio-group v-model="ruleForm.range">
        <el-radio label="public">公开题目</el-radio>
        <el-radio label="user">用户题目</el-radio>
        <el-radio label="match">精选题目</el-radio>
      </el-radio-group>
    </el-form-item>
    <el-form-item v-if="ruleForm.range === 'user'" label="选择用户">
      <el-button @click="dialogVisible2 = true">
        {{
        ruleForm.user ? ruleForm.user.name : "请选择用户"
      }}
      </el-button>
      <el-dialog title="请选择团队" v-model="dialogVisible2" width="900px" close-on-click-modal close-on-press-escape>
        <User :tablekey="['name']" :userhandleCurrentChange="userhandleCurrentChangeuser"></User>
      </el-dialog>
    </el-form-item>
  </div>
</template>

<script setup lang="ts">
import { PropType, ref } from "vue";
import User from "../../../admin/views/User/index.vue";
import Studycodemodel from "../../mysql_interface/studycodemodel";
const dialogVisible2 = ref(false);
const props = defineProps({
  ruleForm: {
    type: Object as PropType<Studycodemodel.Iquestion>,
    required: true,
  },
  userhandleCurrentChange: { type: Function as PropType<(n: Studycodemodel.Iteam) => void>, required: true, },
  userhandleCurrentChangeuser: { type: Function as PropType<(n: Studycodemodel.Iuser) => void>, required: true, },
});

const emit = defineEmits(["update:ruleForm"]);
</script>
